package org.dhbw.cocktail;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;

import lombok.Data;


	/**
	 * Class that holds the Ingredient and Amount for the cocktail that it is used for
	 * 
	 * @author Roland von Werden
	 * @version 0.1
	 */
	@Data
	@Entity(name="jc_used_ingredient")
	public class UsedIngredient {
	
		/** ID for java.persistence */
		@Id
		@GeneratedValue(strategy=GenerationType.AUTO)
		@Column(name="id")
		private long Id;
		
		@ManyToOne(targetEntity=Cocktail.class)
		private Cocktail RefCocktail;
		
		/** Amout of the Ingredient, that is used for the cocktail */
		@Column(name="needed_amount")
		private double NeededAmount = 0.0;
	
		/** Ingredient, that is used for a cocktail */
		@ManyToOne
		private Ingredient Ingredient = null;

		public UsedIngredient() {
			
		}
		
		public UsedIngredient(Ingredient ingr, double amount, Cocktail cck) {
			this.Ingredient = ingr;
			this.NeededAmount = amount;
			this.RefCocktail = cck;
		}
	  
	}